

<script type="text/javascript"> 
           
        /** ------------------------------------
        /**  Live URL Title Function
        /**     Code from ExpressionEngine v 1.6.3
        /**     Slightly modified to accept the parameter fieldcount
        /** -------------------------------------*/
        
        function liveUrlTitle(fieldcount)
        {
        	var defaultTitle = '';
			var NewText = document.getElementById("view_field_label" + fieldcount).value;
			
			if (defaultTitle != '')
			{
				if (NewText.substr(0, defaultTitle.length) == defaultTitle)
				{
					NewText = NewText.substr(defaultTitle.length)
				}	
			}
			
			NewText = NewText.toLowerCase();
			var separator = "_";
			
			if (separator != "_")
			{
				NewText = NewText.replace(/\_/g, separator);
			}
			else
			{
				NewText = NewText.replace(/\-/g, separator);
			}
	
			// Foreign Character Attempt
			
			var NewTextTemp = '';
			for(var pos=0; pos<NewText.length; pos++)
			{
				var c = NewText.charCodeAt(pos);
				
				if (c >= 32 && c < 128)
				{
					NewTextTemp += NewText.charAt(pos);
				}
				else
				{
					if (c == '223') {NewTextTemp += 'ss'; continue;}
				if (c == '224') {NewTextTemp += 'a'; continue;}
				if (c == '225') {NewTextTemp += 'a'; continue;}
				if (c == '226') {NewTextTemp += 'a'; continue;}
				if (c == '229') {NewTextTemp += 'a'; continue;}
				if (c == '227') {NewTextTemp += 'ae'; continue;}
				if (c == '230') {NewTextTemp += 'ae'; continue;}
				if (c == '228') {NewTextTemp += 'ae'; continue;}
				if (c == '231') {NewTextTemp += 'c'; continue;}
				if (c == '232') {NewTextTemp += 'e'; continue;}
				if (c == '233') {NewTextTemp += 'e'; continue;}
				if (c == '234') {NewTextTemp += 'e'; continue;}
				if (c == '235') {NewTextTemp += 'e'; continue;}
				if (c == '236') {NewTextTemp += 'i'; continue;}
				if (c == '237') {NewTextTemp += 'i'; continue;}
				if (c == '238') {NewTextTemp += 'i'; continue;}
				if (c == '239') {NewTextTemp += 'i'; continue;}
				if (c == '241') {NewTextTemp += 'n'; continue;}
				if (c == '242') {NewTextTemp += 'o'; continue;}
				if (c == '243') {NewTextTemp += 'o'; continue;}
				if (c == '244') {NewTextTemp += 'o'; continue;}
				if (c == '245') {NewTextTemp += 'o'; continue;}
				if (c == '246') {NewTextTemp += 'oe'; continue;}
				if (c == '249') {NewTextTemp += 'u'; continue;}
				if (c == '250') {NewTextTemp += 'u'; continue;}
				if (c == '251') {NewTextTemp += 'u'; continue;}
				if (c == '252') {NewTextTemp += 'ue'; continue;}
				if (c == '255') {NewTextTemp += 'y'; continue;}
				if (c == '257') {NewTextTemp += 'aa'; continue;}
				if (c == '269') {NewTextTemp += 'ch'; continue;}
				if (c == '275') {NewTextTemp += 'ee'; continue;}
				if (c == '291') {NewTextTemp += 'gj'; continue;}
				if (c == '299') {NewTextTemp += 'ii'; continue;}
				if (c == '311') {NewTextTemp += 'kj'; continue;}
				if (c == '316') {NewTextTemp += 'lj'; continue;}
				if (c == '326') {NewTextTemp += 'nj'; continue;}
				if (c == '353') {NewTextTemp += 'sh'; continue;}
				if (c == '363') {NewTextTemp += 'uu'; continue;}
				if (c == '382') {NewTextTemp += 'zh'; continue;}
				if (c == '256') {NewTextTemp += 'aa'; continue;}
				if (c == '268') {NewTextTemp += 'ch'; continue;}
				if (c == '274') {NewTextTemp += 'ee'; continue;}
				if (c == '290') {NewTextTemp += 'gj'; continue;}
				if (c == '298') {NewTextTemp += 'ii'; continue;}
				if (c == '310') {NewTextTemp += 'kj'; continue;}
				if (c == '315') {NewTextTemp += 'lj'; continue;}
				if (c == '325') {NewTextTemp += 'nj'; continue;}
				if (c == '352') {NewTextTemp += 'sh'; continue;}
				if (c == '362') {NewTextTemp += 'uu'; continue;}
				if (c == '381') {NewTextTemp += 'zh'; continue;}
				
				}
			}
    
			NewText = NewTextTemp;
			
			NewText = NewText.replace('/<(.*?)>/g', '');
			NewText = NewText.replace('/\&#\d+\;/g', '');
			NewText = NewText.replace('/\&\#\d+?\;/g', '');
			NewText = NewText.replace('/\&\S+?\;/g','');
			NewText = NewText.replace(/['\"\?\.\!*$\#@%;:,=\(\)\[\]]/g,'');
			NewText = NewText.replace(/\s+/g, separator);
			NewText = NewText.replace(/\//g, separator);
			NewText = NewText.replace(/[^a-z0-9-_]/g,'');
			NewText = NewText.replace(/\+/g, separator);
			NewText = NewText.replace(/[-_]+/g, separator);
			NewText = NewText.replace(/\&/g,'');
			NewText = NewText.replace(/-$/g,'');
			NewText = NewText.replace(/_$/g,'');
			NewText = NewText.replace(/^_/g,'');
			NewText = NewText.replace(/^-/g,'');
			
			
				document.getElementById("view_field_name" + fieldcount).value = "" + NewText;			
				
		}
</script>



<!-- Help Tab --> 
<div class="tab_bar"><div class="help_tab" ><font color="white"><h2>Help</h2></font><h3>Fill out the fields you want in your form, with field types, database type, and your validation rules and FormIgniter will output the code for the MVC + a database schema. Give it a go!</h3>
<p>Please note each field needs all details completed, but you don't need to submit all available fields e.g. if you selected a maximum of 10 fields you can submit 8.</p>
<p style="color: #5A5A5A; font-size: 12px;">
If DB field type is "enum" or "set", please enter the values using this format: 'a','b','c'...
<br />If you ever need to put a backslash ("\") or a single quote ("'") amongst those values, precede it with a backslash (for example '\\xyz' or 'a\'b').
</p></div><div class="button_tab"  onclick="$('.help_tab').slideToggle('fast'); " >Help</div></div>








<?php if ($this->session->flashdata('error')): ?>
<div class="top_error"><?php echo $this->session->flashdata('error')?></div>
<?php endif; ?>

<?php // echo validation_errors(); for debuggging only ?>



<?php 
echo form_open( "formigniter/start" ) ;

echo form_hidden('fi_name' 		,$fi_name);
echo form_hidden('field_total' 	,$field_total);

?>

<div class="type_heading" style="padding-top: 10px;" >
Form name : <?php echo $fi_name; ?>



<div class="input_box right buttonbar">
<input type="button" name="fi_save_all"  value="Save" />&nbsp;&nbsp;&nbsp;<input type="button" name="fi_save_all"  value="Save & Build" />
</div>

</div>

<div class="u">
<span class="title_d" ><a  href="#" onclick="switch_link('fi_options', '', this )" class="notxt more" >More</a></span>
</div>



<div id="fi_options" style="display:none" >
<div class="input_box">
<label for="fi_persistence">Persistence</label>
<?php
$fi_persistences = array( 'database' 	=> 'Database');
?>
<?php echo form_dropdown("fi_persistence", $fi_persistences, set_value("fi_persistence")); ?>
</div>

<div class="input_box">
<label for="fi_output">Output</label><?php
$fi_outputs = array('codeigniter2' 	=> 'CodeIgniter 2.0');
?><?php echo form_dropdown("fi_output", $fi_outputs, set_value("fi_output")); ?>
</div>	


<br/>

<div class="input_box">
<label for="fi_cssurl">Css URL</label>
<input name="fi_cssurl" class="double_w" id="fi_cssurl" type="text" value="<?php echo set_value("fi_cssurl"); ?>"  />
</div>



<!--
<div class="input_box">
<label for="fi_field_count">Number of fields</label><?php
$fi_field_counts = array();
for ($count = 1; $count <= 50; $count++ ) { 
	$fi_field_counts[$count] = $count;
}
$fi_field_count_selected = $field_total; 
?><?php echo form_dropdown("fi_field_count", $fi_field_counts, $fi_field_count_selected); ?>
</div>	
-->
</div>
<br/>


<input type="button" name="fi_save_all"  value="Add New Field" />&nbsp;&nbsp;&nbsp;
<input type="button" name="fi_save_all"   value="Collapse All" />



<div id="content">

<!-- Error --> 
<?php if ($form_error): ?>
<div class="important">
<h4>Looks like you have an error or two. Scroll down and correct the highlighted field boxes making sure all fields are filled out.</h4>
</div>
<?php endif; ?>


<?php
for ($count = 1; $count <= $field_total; $count++) // loop to build 10 form boxes
{
?>





<?php
} // end loop
?>

<div style="clear:both"></div>


<?php echo form_close()?>
</div>

